package graph.net.commands;

import graph.net.internal.HelpReference;

/***************************************************
 * @author amahmood
 *
 **************************************************/
public class ShutdownCommand implements ICommand
{

    /* *************************************************
     * @see mule.ps1.net.commands.ICommand#execute(java.lang.String[])
     **************************************************/
    public String execute(String[] parameters)
    {
        if (parameters == null || parameters.length != 2)
        {
            String message = HelpReference.getInstance().getHelp(parameters[0]);
            throw new java.lang.IllegalArgumentException("Invalid command foramt. Correct format is " + message);
        }

        if (parameters[0].equals(CommandName.shutdown.label()) && parameters[1].equals("all"))
        {
            System.out.println("Shutting down the server.");
            System.exit(0);
        }
        
        return "";
    }

}
